public class RunClient {
    public static void main(String[] args) {
        //1.创建三个用户(观察者)
        WxUser zhangsan = new WxUser("zhangsan");
        WxUser lisi = new WxUser("lisi");
        WxUser wangwu = new WxUser("wangwu");
        //创建群聊 （主题），将三个用户添加到群聊中
        Subject wechatGroupSubject = new WechatGroupSubject();
        wechatGroupSubject.attach(zhangsan);
        wechatGroupSubject.attach(lisi);
        wechatGroupSubject.attach(wangwu);
        //通知所有用户
        wechatGroupSubject.notify("hello world");
        System.out.println("---------------------------------------");
        //把wangwu踢出群聊
        wechatGroupSubject.detach(wangwu);
        //通知其他用户
        wechatGroupSubject.notify("wangwu 被踢出群聊");
    }
}
